#!/usr/bin/python
"""
parser_test.py: Tests for parser.py
"""

import unittest
import sys

import annex  # module under test
from annex import util


class ParserTest(unittest.TestCase):

  def testParser(self):
    print annex

    # annex.Parser()
    # initialize empty, then add decorators?  To make it explicit?  Not sure I
    # really like these that much.  Could just leave them out altogther.

    # annex.Parser(rules, actions)
    #
    # In this mode you pass a single string of rules, and a dictionary of
    # actions.
    #
    # annex.Parser.from_module(m) -- or leave it out to get this module?
    #
    # In this mode, you write a Python modules with the rules: docstring and action
    # pairs.
    #
    # ply uses t_ for tokens.  Right now I'm using CAPS for tokens.
    # It uses p_ for parser actions.
    # 
    # I guess I could do the same.
    # or ruleSum
    # SumAction
    # SIGN_Action
    # SIGN_action
    # Sum_action
    #
    # return annex.SimpleValue(p)
    #
    # decorators: rule action register
    #
    # If you're using from_module
    #
    # util.GetActions -- get all functions in a module that have (p)

    # util.GetExtractors -- get all functions in a module that have (match, context)
    #
    #
    # annex.Grammar(f.read(), util.GetActions(__name__))
    #
    # annex.Grammar.from_module(__name__)
    #
    #
    # p -> parsed ->
    #
    # util.GetFunctions(('parsed'))

    # util.GetFunctions(prefix, args)
    # util.GetDocStrings(f)  # just join f.__doc__
    #
    #
    #
    # actions = util.GetActions(module)
    # list of functions, or dictionary
    #
    # TODO:
    #
    # Make parser API and lexer API consistent.
    #
    # lexer is a big dict { state -> edges }
    # parser should maybe be a list of pairs:
    #
    # rule -> function


if __name__ == '__main__':
  unittest.main()
